package cn.zhj.springboot.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.zhj.springboot.domain.Transferrecord;
import cn.zhj.springboot.exception.R;
import cn.zhj.springboot.service.TransferrecordService;
import cn.zhj.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/transferrecord")
//@SaCheckLogin
public class TransferrecordController {

    @Autowired
    private TransferrecordService transferrecordService;

    /**
     * 获取全部用户信息
     * @return
     */
    @GetMapping("/getTransferrecordByUserId/{id}")
//    @SaCheckRole("admin")
    public R<List<Transferrecord>> getTransferrecordByUserId(@PathVariable("id") Long userId) {
        List<Transferrecord> transferrecords = transferrecordService.getTransferrecordByUserId(userId);
        return R.OK(transferrecords);
    }
}
